/*
 * @LastEditors: yuSeen
 * @LastEditTime: 2021-12-19 12:59:17
 * 天凉好个秋
 */

// 切换迷你模式
const toggleMini = (mainWindow, ipcMain) => {
  ipcMain.on("toggle-mini", (event, arg) => {
    console.log(11, arg);
  });
};

// 最小化窗口
const minimize = (mainWindow, ipcMain) => {
  ipcMain.on("minimize", (event, arg) => {
    mainWindow.minimize()
  });
};

// 最大化窗口
const maximize = (mainWindow, ipcMain) => {
  ipcMain.on("maximize", (event, arg) => {
    mainWindow.maximize()
  });
}

// 取消窗口最大化
const unmaximize = (mainWindow, ipcMain) => {
  ipcMain.on("unmaximize", (event, arg) => {
    mainWindow.unmaximize()
  });
}

// 关闭程序
const closemainWindowdow = (mainWindow, ipcMain) => {
  ipcMain.on("closemainWindowdow", (event, arg) => {
    mainWindow.close()
  });
}

// 离开全屏模式
const leaveFullScreen = (mainWindow, ipcMain) => {
  mainWindow.on('unmaximize', (e, cmd) => {
    mainWindow.webContents.send('isFullScreen', false)
  })
}

// 进入全屏模式
const enterFullScreen = (mainWindow, ipcMain) => {
  mainWindow.on('maximize', (e) => {
    mainWindow.webContents.send('isFullScreen', true)
  })
}

module.exports = {
  toggleMini,
  minimize,
  maximize,
  unmaximize,
  closemainWindowdow,
  leaveFullScreen,
  enterFullScreen
}
